package com.factory;

import com.ktjy.dao.CalculateDao;
import com.ktjy.dao.impl.AdditionImpl;
import com.ktjy.dao.impl.DivideImpl;
import com.ktjy.dao.impl.MultiplicationImpl;
import com.ktjy.dao.impl.SubtractionImpl;

public class CalculateFactory {
    public static CalculateDao getInstance(String type){
        switch (type){
            case "add":
                return new AdditionImpl();
            case "sub":
                return new SubtractionImpl();
            case "mul":
                return new MultiplicationImpl();
            case "div":
                return new DivideImpl();
            default:
                throw new RuntimeException("没有该运算类型");
        }
    }
}